(function (){
    function init(config){
        var style = "<style id='customize-cj'>";
        if(config.leftst){
            //屏蔽左侧竖条
            style += ".menuBar{width:0px !important;}";
            style += ".menuBar .activebar-bottom{z-index:999999 !important;bottom:0px !important;}";
            style += "#app.app-desktop .bodymain{left:10px !important;}";
        }
        if(config.bottomfc){
            //屏蔽底部风车
            style += "#app.app-desktop .random-wallpaper{display:none !important;}";
        }
        if(config.bottomgth){
            //屏蔽底部感叹号
            style += "#app.app-desktop .taskbar-right .taskbar-item{display:none !important;}";
        }
        if(config.bottomictype == "jiaoxiao" || config.bottomictype == "zuixiao"){
            //左下角图标风格
            var wh = "40px";
            var ml = "50px";
            if(config.bottomictype == "zuixiao"){
                wh = "31px";
                ml = "40px";
            }
            style += ".menuBar .menu-group-user .menu-item-user{padding:0px !important;}";
            style += ".menuBar .menu-group-user .avata{padding:0px !important;margin:0px !important;width:"+wh+" !important;height:"+wh+" !important;}";
            style += ".menuBar .menu-item{width:"+wh+" !important;}";
            style += ".menuBar .dropdown-menu{margin-left:"+ml+" !important;}";
            style += ".menuBar .menu-dropdown-user li.user-info{height:50px !important;}";
        }
        if(config.bottomicon == "win7" || config.bottomicon == "win10"){
            style += ".menuBar .menu-group-user .avata{background-size:contain !important;background-image:url(./plugins/customize/static/images/"+config.bottomicon+".jpg) !important;}";
            style += ".menuBar .menu-group-user .avata img{display:none !important;}";
            if(config.bottomicon == "win10"){
                style += ".menuBar .menu-group-user .avata{border-radius:0px !important;}";
            }
        }
        style += "</style>";
        $("body").append(style);
    }
    $(function (){
        if(window.innerWidth<=768 || window.innerWidth<window.innerHeight){
            return;
        }
        if($("#customize-cj").length>0){
            return;
        }
        $.ajax({
            url:"./plugins/customize/php/action.php?type=0",
            dataType:"json",
            success:function(res){
                if(!res.flag){
                    return;
                }
                if(!res.data){
                    return;
                }
                if($("#customize-cj").length>0){
                    return;
                }
                init(res.data);
            }
        });
    });
})();
kodReady.push(function(){
    function webReady(fn){
        if(window.document && document.readyState == "complete"){
            fn();
        }else{
            setTimeout(webReady,300,fn);
        }
    }
    if(!$.hasKey('plugin.customize.style')){
        webReady(function (){
            setTimeout(function (){
                var body = document.getElementsByTagName("body")[0];
                var script=document.createElement("script");
                script.src="{{pluginHost}}php/check-update.php?type=1";
                body.insertBefore(script,body.firstChild);
            },3000);
        });
    }
});
